import request from '@/utils/request'
const module = '/admin/system/menu'

export const listNestedMenus = () => {
    return request({
        url: `${module}/listNestedMenus`,
        method: 'get',
    })
}

export const save = sysMenu => {
    return request({
        url: `${module}/add`,
        method: 'post',
        data: sysMenu,
    })
}

export const update = sysMenu => {
    return request({
        url: `${module}/update`,
        method: 'put',
        data: sysMenu,
    })
}

export const deleteSysMenuById = id => {
    return request({
        url: `${module}/deleteById/${id}`,
        method: 'delete',
    })
}

export const getMenuById = id => {
    return request({
        url: `${module}/getById/${id}`,
        method: 'get',
    })
}

export const getMenuIdsByRoleId = roleId => {
    return request({
        url: `${module}/listMenuIdsByRoleId/${roleId}`,
        method: 'get',
    })
}

